openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );
#The code above tells Lapper that when the OnConnect event is triggered (by someone connecting to the server), it should also execute an extra piece of code
CatchEvent OnConnect( $userName )
OnConnect_law_button();
EndCatchEvent
#Sub routine that is executed when someone connects to the server
Sub Onconnect_law_button()
openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );
EndSub
#Sub routine that is executed when someone has clicked the button displayed in sub routine 'Onconnect_law_button'
Sub Laws ( $KeyFlags, $id )
Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub
openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );
openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );
Sub Laws ( $KeyFlags, $id )
#Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub
CatchSub OnConnectClose( $KeyFlags,$id )
OnConnectClose_Info();
EndCatchSub
Sub OnConnectClose_Info()
openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );
openPrivButton( "info_1",33,1,30,5,5,2,96,"^7My Server" );
EndSub
CatchEvent OnLapperStart()
OnLapperStart_Test();
EndCatchEvent
Sub OnLapperStart_Test()
GlobalVar $number_array;
GlobalVar $new_number_array;
$number_array[0]=1;
$number_array[1]=2;
$number_array[2]=3;
$number_array[3]=4;
$number_array[4]=5;
$number_array[5]=6;
$number_array[6]=7;
$number_array[7]=8;
EndSub
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!testarr":
testarr ( $KeyFlags , $argv );
BREAK;
ENDSWITCH
EndCatchEvent
Sub testarr( $KeyFlags,$id )
$NewArray = $number_array;
dumpVar ($NewArray);
$counter=0;
FOREACH( $val IN $NewArray)
writeline ( "DEBUG ARR: " . $val["value"] );
IF ($val["value" ] != 3)
THEN
$new_number_array[$counter] = "" . $val["value" ];
$counter=$counter+1;
ENDIF
ENDFOREACH
dumpVar ($new_number_array);
EndSub
CatchEvent OnLapperStart()
OnLapperStart_Test();
EndCatchEvent
Sub OnLapperStart_Test()
GlobalVar $number_array;
GlobalVar $new_number_array;
$number_array[0]=1;
$number_array[1]=2;
$number_array[2]=3;
$number_array[3]=4;
$number_array[4]=5;
$number_array[5]=6;
$number_array[6]=7;
$number_array[7]=8;
EndSub
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!testarr":
testarr ( $KeyFlags , $argv );
BREAK;
ENDSWITCH
EndCatchEvent
Sub testarr( $KeyFlags,$id )
dumpVar ($number_array);
$counter=0;
FOREACH( $val IN $number_array)
writeline ( "DEBUG ARR: " . $val["value"] );
IF ($val["value" ] != 3)
THEN
$new_number_array[$counter] = $val["value" ];
ENDIF
$counter=$counter+1;
ENDFOREACH
dumpVar ($new_number_array);
EndSub